<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/1/3
 * Time: 13:33
 */
//利用Google API生成二维码


function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')
{
    $chl = urlencode($chl);
    echo '<img src="http://chart.apis.google.com/chart?chs='.$widhtHeight.'x'.$widhtHeight.' 
    &cht=qr&chld='.$EC_level.'|'.$margin.'&chl='.$chl.'" alt="QR code" widhtHeight="'.$widhtHeight.' 
    " widhtHeight="'.$widhtHeight.'"/>';

}
$urlToEncode="http://www.learnphp.cn";
generateQRfromGoogle($urlToEncode);
